#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>

void Swap(int* x, int* y)
{
	int temp = *x;
	*x = *y;
	*y = temp;
}

void moveZeroes(int* nums, int numsSize) {
	int dest = 0, cur = 1;
	while(cur<numsSize)
	{
		if (nums[dest] == 0) 
		{
			if (nums[cur] != 0)
			{
				Swap(&nums[dest], &nums[cur]);
				dest++;
				cur++;
			}
			else
			{
				cur++;
			}
		}
		else
		{
			dest++;
			cur++;
		}
	}
}

int main()
{
	int arr[5] = { 0,1,0,3,12 };
	moveZeroes(arr, 5);
	for (int i = 0; i < 5; i++)
	{
		printf("%d ", arr[i]);
	}
	return 0;
}